import { post, get } from '@/utils/request'

/**
 * 分类相关接口
 */
export const categoryApi = {
  // 获取分类列表
  getList: (data) =>
    post('/categoryApi/getList', {
      ...data,
      pageSize: data.pageSize || 10,
      pageNum: data.pageNum || 1,
    }),

  // 新增分类
  addCategory: (data) => post('/categoryApi/add', data),

  // 更新分类
  updateCategory: (data) => post('/categoryApi/edit', data),

  // 删除分类（可批量）
  deleteCategory: (ids) => post('/categoryApi/delete', { ids }),

  // 修改排序
  updateOrder: (id, orderNum) => post('/categoryApi/editOrder', { id, orderNum }),

  // 获取所有分类
  getAll: () => get('/categoryApi/getAll'),
}
